#ifndef USERMANAGEMENT_H
#define USERMANAGEMENT_H

#include <QDialog>
#include"mainwindow.h"
#include<QTableWidgetItem>
#include<QInputDialog>
namespace Ui {
class UserManageMent;
}

class UserManageMent : public QDialog
{
    Q_OBJECT

public:
    explicit UserManageMent(QWidget *parent = nullptr);
    static UserManageMent* instance();
    ~UserManageMent();

private slots:
    void on_pushButton_Back_clicked();

    void on_pushButtonCheckAccount_clicked();
    void on_pushButtonClear_clicked();

    void on_pushButtonDeleteAccount_clicked();
    void upDataTheTable(const bool &ok);
    void upDataUserInformation(const bool &ok);
    void on_pushButtonAddUser_clicked();

    void on_pushButtonChange_clicked();

signals:
    void deleteUserInfomation(const bool &ok);
    void saveUserInformation(const bool &ok);
    void changeUserInfomation(const bool&ok);
    void addUserInfomation(const bool&ok);
private:
    bool getUserInformation(QVector<UserInfo>&Data);
    void setUserTableWidgetList(int row,int column=5);
    void initlineEditAccountNumber();
    int checkAccountNumberIndex(const QString &accountNumber,const QVector<UserInfo> &Data);
    void setTableDisplay(bool on_off=false,const int mode=1);
    void clearTable();
    void initAddorChangeLineEdit();
    void setTipLineEdit();
    int checkUserIsExist( UserInfo&Data,QVector<UserInfo>&DataSet);
private:
   QVector<UserInfo> UserInformation;//存储用户信息
    Ui::UserManageMent *ui;
};

#endif // USERMANAGEMENT_H
